package com.karst.essentials.chapter06
{
	import com.karst.essentials.chapter06.galaxyExample.GalaxyExample;
	
	import flash.display.Sprite;
	
	public class Chapter06View extends Sprite
	{
		public static const SECTION_LIST : Array = 
			["鼠标交互-基本的鼠标交互", "鼠标交互-带渐变的鼠标移动",
			"鼠标交互-用鼠标来旋转物体", 
			"相机的轨道运行-移动鼠标实现-普通", "相机的轨道运行-移动鼠标实现-缓动",
			"相机的轨道运行-拖拽鼠标实现-普通", "相机的轨道运行-拖拽鼠标实现-缓动",
			"固定相机-拖拽鼠标实现-缓动",
			"三维物体的补间", "相机的曲线补间", 
			"例子——扩展的银河系"
			 ] ;
		
		public function Chapter06View()
		{
			super();
		}
		
		
		public function showSection( $section : String = "" ) : void
		{
			while( numChildren )
				removeChildAt( 0 ) ;
			switch( $section )
			{
				case SECTION_LIST[0] :
					createMouseInteractionExample0() ;
					break ;
				case SECTION_LIST[1] :
					createMouseInteractionExample1() ;
					break ;
				case SECTION_LIST[2] :
					createMouseInteractionExample2() ;
					break ;
				case SECTION_LIST[3] :
					createOrbitExample1() ;
					break ;
				case SECTION_LIST[4] :
					createOrbitExample2() ;
					break ;
				case SECTION_LIST[5] :
					createOrbitExample3() ;
					break ;
				case SECTION_LIST[6] :
					createOrbitExample4() ;
					break ;
				case SECTION_LIST[7] :
					createOrbitExample5() ;
					break ;
				case SECTION_LIST[8] :
					createTweenerCubeExample() ;
					break ;
				case SECTION_LIST[9] :
					createTweenerCameraExample() ;
					break ;
				case SECTION_LIST[10] :
					createGalaxyExample() ;
					break ;
			}
		}

		private var mouseInteractionExample0 : MouseInteractionExample0 = null ;
		private function createMouseInteractionExample0() : void
		{
			if( mouseInteractionExample0 == null )
				mouseInteractionExample0 = new MouseInteractionExample0() ;
			addChild( mouseInteractionExample0 ) ;
			mouseInteractionExample0.x = 5 ;
			mouseInteractionExample0.y = 35 ;
		}

		private var mouseInteractionExample1 : MouseInteractionExample1 = null ;
		private function createMouseInteractionExample1() : void
		{
			if( mouseInteractionExample1 == null )
				mouseInteractionExample1 = new MouseInteractionExample1() ;
			addChild( mouseInteractionExample1 ) ;
			mouseInteractionExample1.x = 5 ;
			mouseInteractionExample1.y = 35 ;
		}

		private var mouseInteractionExample2 : MouseInteractionExample2 = null ;
		private function createMouseInteractionExample2() : void
		{
			if( mouseInteractionExample2 == null )
				mouseInteractionExample2 = new MouseInteractionExample2() ;
			addChild( mouseInteractionExample2 ) ;
		}

		private var orbitExample1 : OrbitExample1 = null ;
		private function createOrbitExample1() : void
		{
			if( orbitExample1 == null )
				orbitExample1 = new OrbitExample1() ;
			addChild( orbitExample1 ) ;
		}

		private var orbitExample2 : OrbitExample2 = null ;
		private function createOrbitExample2() : void
		{
			if( orbitExample2 == null )
				orbitExample2 = new OrbitExample2() ;
			addChild( orbitExample2 ) ;
		}

		private var orbitExample3 : OrbitExample3 = null ;
		private function createOrbitExample3() : void
		{
			if( orbitExample3 == null )
				orbitExample3 = new OrbitExample3() ;
			addChild( orbitExample3 ) ;
		}

		private var orbitExample4 : OrbitExample4 = null ;
		private function createOrbitExample4() : void
		{
			if( orbitExample4 == null )
				orbitExample4 = new OrbitExample4() ;
			addChild( orbitExample4 ) ;
		}

		private var orbitExample5 : OrbitExample5 = null ;
		private function createOrbitExample5() : void
		{
			if( orbitExample5 == null )
				orbitExample5 = new OrbitExample5() ;
			addChild( orbitExample5 ) ;
		}

		private var tweenerCubeExample : TweenerCubeExample = null ;
		private function createTweenerCubeExample() : void
		{
			if( tweenerCubeExample == null )
				tweenerCubeExample = new TweenerCubeExample() ;
			addChild( tweenerCubeExample ) ;
		}

		private var tweenerCameraExample : TweenerCameraExample = null ;
		private function createTweenerCameraExample() : void
		{
			if( tweenerCameraExample == null )
				tweenerCameraExample = new TweenerCameraExample() ;
			addChild( tweenerCameraExample ) ;
		}

		private var galaxyExample : GalaxyExample = null ;
		private function createGalaxyExample() : void
		{
			if( galaxyExample == null )
				galaxyExample = new GalaxyExample() ;
			addChild( galaxyExample ) ;
		}
	}
}